# -*- coding: utf-8 -*-

import time

from base.adapter import DataServer
from engine.event_engine import EventEngine
from base.strategy_engine import IStrategyEngine
from dbhelper.box_db import DbHelper


class StrategyTest():
    def __init__(self):
        self.db_client = DbHelper()
        # self.init_event_engine()
        # 行情事件引擎
        self.quote_event_engine = EventEngine()
        self.quote_event_engine.start()
        time.sleep(1)
        # self._create_quote_status_item()
        # 交易事件引擎
        self.trade_event_engine = EventEngine()
        self.trade_event_engine.start()
        time.sleep(1)
        # self._register_trade_event(self.trade_event_engine)
        # 数据事件引擎
        self.data_event_engine = EventEngine()
        self.data_event_engine.start()
        # 策略事件引擎
        self.strategy_event_engine = EventEngine()
        self.strategy_event_engine.start()
        # 风控事件引擎
        self.risk_event_engine = EventEngine()
        self.risk_event_engine.start()

        self.data_server = DataServer(db_client=self.db_client, quote_event_engine=self.quote_event_engine,
                                      trade_event_engine=self.trade_event_engine,
                                      strategy_event_engine=self.strategy_event_engine,
                                      risk_event_engine=self.risk_event_engine,
                                      data_event_engine=self.data_event_engine)
        self.strategy_engine = IStrategyEngine(data_engine=self.data_server, db_client=self.db_client)


if __name__=='__main__':
    st = StrategyTest()